from base import Base
from selenium.webdriver.common.by import By
class Page(Base):
    def ssk(self):
        print('点击搜索框')
        loc = (By.ANDROID_UIAUTOMATOR, 'new UiSelector().text("搜索菜谱")')
        ele = self.find_ele(loc)
        return ele
    def sr(self):
        print('输入搜索内容')
        loc = (By.CLASS_NAME, 'android.widget.EditText')
        ele = self.find_ele(loc)
        return ele
    def djss(self):
        print('点击搜索按钮')
        loc = (By.XPATH, '//android.widget.TextView[@text="搜索"]')
        ele = self.find_ele(loc)
        return ele
    def tp2(self):
        print('点击图片')
        loc=(By.ANDROID_UIAUTOMATOR,'new UiSelector().resourceId("com.xiachufang:id/item_img").instance(1)1')
        ele=self.find_ele(loc)
        return ele
    def tp1(self):
        print('点击图片')
        loc=(By.ANDROID_UIAUTOMATOR,'new UiSelector().resourceId("com.xiachufang:id/common_photo_image_view").instance(0)')
        ele=self.find_ele(loc)
        return ele
    def sc(self):
        print('点击收藏按钮')
        loc=(By.ID,'com.xiachufang:id/recipe_bto_nav_bar_collect')
        ele = self.find_ele(loc)
        return ele
    def fh(self):
        print('点击返回按钮')
        loc=(By.XPATH,'//android.widget.ImageView[@content-desc="返回"]')
        ele = self.find_ele(loc)
        return ele
    def dy1(self):
        print('断言推荐是否存在')
        loc=(By.XPATH,'//android.widget.TextView[@resource-id="android:id/text1" and @text="推荐"]')
        ele = self.find_ele(loc)
        return ele
    def dy2(self):
        print('断言家常是否存在')
        loc = (By.XPATH, '//android.widget.TextView[@resource-id="com.xiachufang:id/tv_content" and @text="家常"]')
        ele = self.find_ele(loc)
        return ele
    def dy3(self):
        print('断言新手是否存在')
        loc = (By.ANDROID_UIAUTOMATOR, 'new UiSelector().text("新手")')
        ele = self.find_ele(loc)
        return ele